unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, IfxConnection, Grids, DBGrids, DBClient, Provider, IfxCustomDataset,
  IfxUpdateSQL, IfxQuery, StdCtrls, DBTables;

type
  TForm1 = class(TForm)
    IfxConnection1: TIfxConnection;
    IfxQuery1: TIfxQuery;
    IfxUpdateSQL1: TIfxUpdateSQL;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Button1: TButton;
    Memo1: TMemo;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure IfxQuery1AfterOpen(DataSet: TDataSet);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  IfxQuery1.Active := not IfxQuery1.Active;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  IfxQuery1.ApplyUpdates;
end;

procedure TForm1.IfxQuery1AfterOpen(DataSet: TDataSet);
var
  I: Integer;
  S: string;
begin
  Memo1.Lines.Clear;
  for I := 0 to IfxQuery1.FieldCount - 1 do
  begin
    DateTimeToString(S, 'yyyy-mm-dd hh:nn:ss.zzz', IfxQuery1.Fields[I].Value);
    Memo1.Lines.Add(S + ' = ' + IfxQuery1.Fields[I].FieldName);
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  I: Integer;
begin
  IfxQuery1.Open;
  IfxQuery1.Edit;
  for I := 0 to IfxQuery1.FieldCount - 1 do
    IfxQuery1.Fields[I].Value := Now;
  IfxQuery1.Post;
end;

end.
